Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance MetaDataEditor When Selecting Many Images #5122

Conversation

thomaslow
Copy link
Collaborator

@thomaslow thomaslow commented May 6, 2022

Related Issues:

In a meta data editor with 2000 images, the method DataEditorForm.consecutivePagesSelected is called over 2000 times when selecting an image. For large gallery sections (>100 images) and large selections (>10 images), it's execution time is relatively slow (milliseconds), which adds up when called over 2000 times to multiple seconds.

For example, when selecting 50 images in a gallery section of 500 images:

simplescreenrecorder-2022-05-06_10.39.12.mp4

Or, when selecting:

  • 1 image in a gallery section of 80 images: 21.6 ms.
  • 1 image in a gallery section of 500 images: 483ms
  • 10 images in a gallery section of 80 images: 105ms
  • 10 images in a gallery section of 500 images: 2.8 seconds
  • 100 images in a gallery section of 500 images: 23.7 seconds

Most of it's execution time seems to be related to the distinct().count() call. For large selections, this should be slower, since it involves pairwise comparisons. However, I'm not sure why it is also slower for large gallery sections, since the size of a gallery section should not have any influence here.

Anyway, the proposed implementation improves the runtime of the method signficantly. The same selection of 50 images loads much faster:

simplescreenrecorder-2022-05-06_10.36.52.mp4

The execution time of DataEditorForm.consecutivePagesSelected is reduced to about 36ms in the worst case (selecting 500 images in a gallery section of 500).

The remaining delay when selecting images is related to the full reloading of the gallery, structure and pagination panel.

@Kathrin-Huber Kathrin-Huber merged commit d264626 into kitodo:master May 13, 2022
@thomaslow thomaslow deleted the performance-metadataeditor-when-selecting-many-images branch May 19, 2022 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants